package com.example.demo.level2;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: zhangyang
 * @Date: 2020/4/19 17:00
 */
@SuppressWarnings("JavaDoc")
public class LearnMap {

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>(3);
        map.put("S001", "张三");
        map.put("S002", "李四");
        map.put("S003", "王五");

        // 删除：
        map.remove("S000"); //直接删除建即可

        // 修改：
        map.put("S003", "王五");

        // 查询：
        //查询Keys
        for (String key : map.keySet()) {
            System.out.println("Key:" + key + "  Name:" + map.get(key));
        }

        // 查询 value
        for (String value : map.values()) {
            System.out.println("Name:" + value);
        }

    }

}
